package com.taomu.app.zongchouhuli.http.api;

import com.taomu.app.zongchouhuli.entity.BaseChangeResponse;
import com.taomu.app.zongchouhuli.entity.BaseResponse;
import com.taomu.app.zongchouhuli.entity.BaseResponse2;
import com.taomu.app.zongchouhuli.http.res.ResArticleEntity;
import com.taomu.app.zongchouhuli.http.res.ResBankEntity;
import com.taomu.app.zongchouhuli.http.res.ResChoiceRechargeEntity;
import com.taomu.app.zongchouhuli.http.res.ResImportNoticeEntity;
import com.taomu.app.zongchouhuli.http.res.ResLunBoEntity;
import com.taomu.app.zongchouhuli.http.res.ResMainProductListEntity;
import com.taomu.app.zongchouhuli.http.res.ResMyBankListEntity;
import com.taomu.app.zongchouhuli.http.res.ResMyBuyProductEntity;
import com.taomu.app.zongchouhuli.http.res.ResNoticeEntity;
import com.taomu.app.zongchouhuli.http.res.ResOrderEntity;
import com.taomu.app.zongchouhuli.http.res.ResOrderListEntity;
import com.taomu.app.zongchouhuli.http.res.ResProductDetailEntity;
import com.taomu.app.zongchouhuli.http.res.ResProductEntity;
import com.taomu.app.zongchouhuli.http.res.ResProductIncomeDetailEntity;
import com.taomu.app.zongchouhuli.http.res.ResProductRebateEntity;
import com.taomu.app.zongchouhuli.http.res.ResRebateDeatailEntity;
import com.taomu.app.zongchouhuli.http.res.ResSelectBankEntity;
import com.taomu.app.zongchouhuli.http.res.ResSpreadEntity;
import com.taomu.app.zongchouhuli.http.res.ResUpdateInfoEntity;
import com.taomu.app.zongchouhuli.http.res.ResUserInfoEntity;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.HEAD;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.Url;

/**
 * keZhong
 * 2018/9/22 13:53
 */
public interface ApiService {

    String VERSION = "1.0.0";

    /**
     * 获取Post请求响应数据
     *
     * @param token  授权token
     * @param action 请求的url地址
     * @param param  post请求参数
     * @return Observable<ResponseBody> ResponseBody响应流
     */
    @Headers({"version:" + VERSION})
    @POST
    Observable<ResponseBody> post(@Header("token") String token, @Url String action, @Body Object param);
    /**
      * 获取Post请求响应数据
      */
    @GET
    Observable<ResponseBody> get(@Header("token") String token, @Url String url, @QueryMap Map<String, String> queryMap);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getRegister(@Url String url,@Field("phone") String phone,@Field("password") String password,@Field("pay_password") String pay_pass,@Field("code") String code,@Field("invite_code") String invite_code);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getLogin(@Url String url,@Field("phone") String phone,@Field("password") String password);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getFindPassword(@Url String url,@Field("phone") String phone,@Field("password") String password,@Field("code") String code);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getSmsCode(@Url String url,@Field("phone") String phone);

    @FormUrlEncoded
    @POST
    Observable<ResMainProductListEntity> getMainPageProductList(@Url String url, @Field("tip") String tip);

    @FormUrlEncoded
    @POST
    Observable<ResOrderListEntity> getOrderList(@Url String url, @Header("token") String token, @Header("uid") String uid, @Field("status") String tip, @Field("ship") String ship, @Field("take") String take);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getProductDetailInfo(@Url String url, @Field("product_id") String _id);

    @GET
    Observable<ResponseBody> getUserInfo(@Url String url, @Header("token") String token,@Header("uid") String ui);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> setGenderInfo(@Url String url, @Header("token") String token,@Header("uid") String ui, @Field("sex") String gender);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> setNickNameInfo(@Url String url, @Header("token") String token,@Header("uid") String ui, @Field("username") String nick);

    /**
     *
     * @param url
     * @param token
     * @param ship 从第几条查询
     * @param take 查询几条
     * @return
     */
    @FormUrlEncoded
    @POST
    Observable<ResMyBankListEntity> getBankListData(@Url String url, @Header("token") String token, @Header("uid") String ui, @Field("ship") String ship, @Field("take") String take);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> addBankCard(@Url String url, @Header("token") String token,@Header("uid") String ui, @Field("card_username") String username,@Field("bank_num") String kaihubank, @Field("card_num") String banknum,@Field("card_phone") String phone,@Field("code") String code);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> changedBankCard(@Url String url, @Header("token") String token,@Header("uid") String ui, @Field("id") String id,@Field("card_username") String username,@Field("card_phone") String kaihubank, @Field("card_num") String banknum,@Field("phone") String phone,@Field("code") String code);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getBankInfo(@Url String url, @Header("token") String token,@Header("uid") String ui, @Field("id") String id);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> deleteBank(@Url String url, @Header("token") String token,@Header("uid") String ui, @Field("id") String id);

    @GET
    Observable<ResMainProductListEntity> getProductListData(@Url String url, @Query("product_name") String product_name,@Query("ship") String ship,@Query("take") String take,@Query("order") String order,@Query("desc") String desc);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> setTradePwd(@Url String url, @Header("token") String token,@Header("uid") String ui, @Field("phone") String id,@Field("code") String code,@Field("password") String pay_pass,@Field("re_password") String re_password,@Field("type") String type);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getOrderData(@Url String url,@Header("token") String token,@Header("uid") String ui, @Field("product_id") String product_id,@Field("quantity") String quantity,@Field("income_type") String income_type, @Field("distribution_id") String distribution_id);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> payOrderData(@Url String url,@Header("token") String token,@Header("uid") String ui, @Field("order_id") String order_id,@Field("password") String password,@Field("product_id") String product_id, @Field("distribution_id") String distribution_id);

    @GET
    Observable<ResponseBody> cancleOrder(@Url String url,@Header("token") String token,@Header("uid") String ui, @Query("order_id") String order_id);

    @GET
    Observable<ResponseBody> deleteOrder(@Url String url,@Header("token") String token,@Header("uid") String ui, @Query("order_id") String order_id);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> confirmPhone(@Url String url,@Header("token") String token,@Header("uid") String ui, @Field("phone") String phone,@Field("code") String code);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> changedPhone(@Url String url,@Header("token") String token,@Header("uid") String ui, @Field("phone") String phone,@Field("code") String code);

    @GET
    Observable<ResponseBody> getChoiceRechargeInfo(@Url String url,@Header("token") String token,@Header("uid") String ui);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> confirmRecharge(@Url String url,@Header("token") String token,@Header("uid") String ui, @Field("id") String id,@Field("order_id") String order_id,@Field("recharge_username") String recharge_username,@Field("recharge_num") String recharge_num,@Field("recharge_date") String recharge_date,@Field("total_fee") String total_fee,@Field("pay_total_fee") String pay_total_fee,@Field("touch_us") String touch_us,@Field("to_username") String to_username,@Field("to_num") String to_num);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getCrash(@Url String url,@Header("token") String token,@Header("uid") String ui, @Field("total_fee") int total_fee,@Field("bank_id") String bank_id);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getWallet(@Url String url, @Header("token") String token,@Header("uid") String ui, @Field("type") String type, @Field("ship") String ship, @Field("take") String take);

    @POST
    Observable<ResponseBody> getThisMonthDistributeFee(@Url String url, @Header("token") String token,@Header("uid") String ui);

    @GET
    Observable<ResponseBody> getDistributeInfo(@Url String url, @Header("token") String token,@Header("uid") String ui, @Query("id") String id);

    @FormUrlEncoded
    @POST
    Observable<ResSpreadEntity> getMyDistribute(@Url String url, @Header("token") String token, @Header("uid") String ui, @Field("ship") String ship, @Field("take") String take);

    @GET
    Observable<ResponseBody> getLevenl(@Url String url, @Header("token") String token,@Header("uid") String ui);

    @GET
    Observable<ResponseBody> getContractInfo(@Url String url, @Query("id") String id,@Header("token") String token,@Header("uid") String ui);

    @FormUrlEncoded
    @POST
    Observable<ResMyBuyProductEntity> getMyProductList(@Url String url, @Header("token") String token, @Header("uid") String ui, @Field("ship") String ship, @Field("take") String take);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getMyProductList2(@Url String url, @Header("token") String token, @Header("uid") String ui, @Field("ship") String ship, @Field("take") String take);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getProductIncomeDetail(@Url String url, @Header("token") String token, @Header("uid") String ui, @Field("id") String product_id,@Field("ship") String ship,@Field("take") String take);

//    api/recharge/rechargeOrder
    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getSubmitRechargeOrder(@Url String url, @Header("token") String token, @Header("uid") String ui, @Field("total_fee") String total_fee,@Field("recharge_type_id") String recharge_type_id);

    @GET
    Observable<ResNoticeEntity> getNoticeList(@Url String url);

    @GET
    Observable<ResponseBody> getNoticeContent(@Url String url,@Query("id") String id);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getSettingHeader(@Url String url,@Header("token") String token,@Header("uid") String uid,@Field("user_img_uri") String img);

    @FormUrlEncoded
    @POST
    Observable<ResArticleEntity> getArticleInfo(@Url String url, @Field("id") String id,@Header("token") String token,@Header("uid") String uid);

    @GET
    Observable<ResponseBody> getShare(@Url String url,@Query("productId") String productId,@Query("userId") String userid);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getSellProduct(@Url String url,@Header("token") String token,@Header("uid") String uid,@Field("id") String id);

    @GET
    Observable<ResSelectBankEntity> getSelectBank(@Url String url,@Header("token") String token,@Header("uid") String uid);

//    api/ProductPay/updateIncomeType
    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getChangedJiesun(@Url String url,@Header("token") String token,@Header("uid") String uid,@Field("id") String id,@Field("income_type") String income_type);

    @GET
    Observable<ResLunBoEntity> getLunboInfo(@Url String url);

    @FormUrlEncoded
    @POST
    Observable<ResponseBody> getTranferProductAccount(@Url String url,@Header("token") String token,@Header("uid") String uid,@Field("total_fee") String total_fee,@Field("type") String type);

    @FormUrlEncoded
    @POST
    Observable<ResRebateDeatailEntity> getRebateDetailInfo(@Url String url, @Header("token") String token, @Header("uid") String uid, @Field("id") String id);

    @POST
    Observable<ResponseBody> getImportNoticeInfo(@Url String url);

    @FormUrlEncoded
    @POST
    Observable<ResUpdateInfoEntity> getUpdateApp(@Url String url,@Field("app_id") String appid,@Field("version_code") String version_code);
}
